const Router = require('koa-router')
const getWlanAddress = require('./handle/getip')

const router = new Router()

// 定义一个路由来获取 WLAN 地址
router.get('/ip', async (ctx) => {
  try {
    const wlanAddress = await getWlanAddress()
    ctx.body = { wlanAddress }
  } catch (error) {
    console.log(error)
    ctx.status = 500
    ctx.body = { error: 'Failed to get WLAN address' }
  }
})

module.exports = router
